package com.github.xiaolyuh.entity;


import com.github.xiaolyuh.constant.Constant;
import com.sun.deploy.util.StringUtils;

import java.util.Arrays;
import java.util.Objects;

import static com.github.xiaolyuh.constant.Constant.*;

/**
 * 缓存key
 */
public class CacheKey2 {

	/**
	 * 组拼 key
	 *
	 * @param siteCode
	 * @param activityId
	 * @return
	 */
	public static String getActivityKey(String siteCode, String activityId) {
		String key = Constant.PROMOTION_ACTIVITY + SEPAREATOR_CHARACTER + siteCode
				+ SEPAREATOR_CHARACTER + activityId;
		return key;
	}

	/**
	 * 共享使用次数key
	 * @param conditionId
	 * @param siteCode
	 * @param goodSn
	 * @return
	 */
	public static String buildShareCountKey(String conditionId, String siteCode, String goodSn) {
		Object[] keys = new Object[] { PROMOTION_PRICE_SHARE_QTY, siteCode, conditionId, goodSn};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 用户价格使用次数（绑定sku）
	 * 
	 * @param siteCode
	 * @param userId
	 * @param conditionId
	 * @param goodSn
	 * @return
	 */
	public static String buildPriceUserCounterKey(String siteCode, String pipelineCode, Long userId, String conditionId,
			String goodSn) {
		Object[] keys = new Object[] { PROMOTION_PRICE_USER_COUNTER, siteCode, pipelineCode, conditionId, goodSn,
				userId };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 价格信息key
	 * 
	 * @param siteCode
	 * @param pipelineCode
	 * @param warehouseCode
	 * @param goodSn
	 * @return
	 */
	public static String buildPriceKey(String siteCode, String pipelineCode, String warehouseCode,
			String goodSn) {
		Object[] keys = new Object[] { PROMOTION_PRICE, siteCode, pipelineCode, warehouseCode, goodSn };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

    /**
     * 赠送抽奖次数
     *
     * @param siteCode
     * @param activityId
     * @param userId
     * @return
     */
    public static String buildGiveRaffleCountKey(String siteCode, String activityId, Long userId) {
        Object[] keys = new Object[] { PROMOTION_ACTIVITY_USER, siteCode, activityId, userId};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

	/**
	 * 价格使用次数
	 *
	 * @param siteCode
	 * @param conditionId
	 * @param goodSn
	 * @return
	 */
	public static String buildPriceCounterKey(String siteCode, String pipelineCode, String conditionId, String goodSn) {
		Object[] keys = new Object[] { PROMOTION_PRICE_USER_COUNTER, siteCode, pipelineCode, conditionId, goodSn };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 赠送抽奖次数（总计）
	 *
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @param type
	 * @return
	 */
	public static String buildGiveRaffleCountKey(String siteCode, String activityId, Long userId, Integer type) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_GIVE_USE_COUNTER, siteCode, activityId, userId, type};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 分享抽奖活动的次数
	 * 
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @return
	 */
	public static String buildShareRaffleCountKey(String siteCode, String pipelineCode, String activityId, Long userId) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_SHARE, siteCode, pipelineCode, activityId, userId };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 集赞兑换次数
	 * @param siteCode      - 站点编码
	 * @param activityId    - 活动ID
	 * @param userId        - 用户ID
	 * @return
	 * Created by JinLin.Yang on 2018/7/7/0007 15:12
	 */
	public static String buildPraiseRaffleCountKey(String siteCode, String activityId, Long userId) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_PRAISE, siteCode, activityId, userId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
     * 订单兑换次数
     * @param siteCode      - 站点编码
     * @param activityId    - 活动ID
     * @param userId        - 用户ID
     * @param orderSn       - 订单号
	 * @return
	 * Created by JinLin.Yang on 2018/7/7/0007 20:20
	 */
	public static String buildOrderRaffleCountKey(String siteCode, String activityId, Long userId, String orderSn) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_ORDER, siteCode, activityId, userId, orderSn};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 抽奖活动信息
	 * 
	 * @param siteCode
	 * @param activityId
	 * @return
	 */
	public static String buildRaffleActivityKey(String siteCode, String activityId) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE, siteCode, activityId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 用户抽奖参与次数 (总计数)
	 * @param siteCode   - 站点编码
	 * @param activityId - 活动ID
	 * @param userId     - 用户ID
	 * @param countType  - 赠送类型
	 * @param userType   - 用户类型
	 * @return
	 */
	public static String buildRaffleUserCounterKey(String siteCode, String activityId, Long userId, Integer countType, Integer userType) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_USER_COUNTER, siteCode, activityId, userId, countType, userType};
		String counterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return counterKey;
	}

	/**
	 * 抽奖用户锁
     *
	 * @return
	 */
	public static String buildRaffleLockKey(String siteCode, String activityId, Long userId) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_LOCK, siteCode, activityId, userId};
		String dayUserCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return dayUserCounterKey;
	}


	/**
	 * 奖品用户中奖次数
	 * 
	 * @param siteCode
	 * @param activityId
	 * @param prizeRank
	 * @return
	 */
	public static String buildPrizeUserCounterKey(String siteCode, String activityId, Integer prizeRank, Long userId) {
		Object[] keys = new Object[] { PROMOTION_PRIZE_USE_COUNTER, siteCode, activityId, prizeRank, userId};
		String userCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return userCounterKey;
	}

	/**
	 * 奖品中奖次数
	 * 
	 * @param siteCode
	 * @param activityId
	 * @param prizeRank
	 * @return
	 */
	public static String buildPrizeCounterKey(String siteCode, String activityId, Integer prizeRank) {
		Object[] keys = new Object[] { PROMOTION_PRIZE_COUNTER, siteCode, activityId, prizeRank};
		String counterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return counterKey;
	}

    /**
     * 奖品锁
     *
     * @return
     */
    public static String buildRafflePrizeLockKey(String siteCode, String activityId, Integer prizeRank) {
        Object[] keys = new Object[] { PROMOTION_RAFFLE_PRIZE_LOCK, siteCode, activityId, prizeRank};
        String dayUserCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
        return dayUserCounterKey;
    }

	/**
	 * 配件使用次数
	 * 
	 * @param siteCode
	 * @param priceId
	 * @return
	 */
	public static String buildPartsCounterKey(String siteCode, String priceId) {
		Object[] keys = new Object[] { PARTS_COUNT_INFO, siteCode, priceId };
		String partsCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return partsCounterKey;
	}

	/**
	 * coupon用户使用次数
	 * 
	 * @param siteCode
	 * @param code
	 * @param userId
	 * @return
	 */
	public static String buildCouponUserCounterKey(String siteCode, String code, Long userId) {
		Object[] keys = new Object[] { PROMOTION_COUPON_USER_COUNTER, siteCode, code, userId };
		String couponUserCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return couponUserCounterKey;
	}

	/**
	 * coupon使用次数
	 * 
	 * @param siteCode
	 * @param code
	 * @return
	 */
	public static String buildCouponCounterKey(String siteCode, String code) {
		Object[] keys = new Object[] { PROMOTION_COUPON_USER_COUNTER, siteCode, code };
		String couponCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return couponCounterKey;
	}


	/**
	 * 获取模板发放coupon总次数Key
	 */
	public static String buildTemplateCouponTotalCountKey(String siteCode,String code){
		Object[] keys = new Object[] { COUPON_TEMPLATE_COUNT_INFO, siteCode, code };
		String counterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return counterKey;
	}
	/**
	 * 获取模板发放coupon总次数Key(系统多段领取)
	 */
	public static String buildTemplateCouponTotalCountKey(String siteCode,String code,Integer sequence){
		if(Objects.isNull(sequence)){
			return buildTemplateCouponTotalCountKey(siteCode,code);
		}
		Object[] keys = new Object[] {COUPON_TEMPLATE_TOTAL_COUNT_INFO, siteCode, code,sequence };
		String counterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return counterKey;
	}
	/**
	 * 用户普通活动使用次数
	 * 
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @return
	 */
	public static String buildActivityUserCounterKey(String siteCode, String activityId, Long userId) {
		Object[] keys = new Object[] { PROMOTION_ACTIVITY_CNT, siteCode, activityId, userId };
		String activityCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return activityCounterKey;
	}

	public static String buildActivityRuleCounterKey(String siteCode, String activityId, Integer priority,boolean forceNew) {
		if(forceNew){
			Object[] keys = new Object[] {PROMOTION_ACTIVITY_RULE_CNT, siteCode, activityId, priority };
			String activityCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
			return activityCounterKey;
		}else{
			Object[] keys = new Object[] {PROMOTION_ACTIVITY_CNT, siteCode, activityId, priority };
			return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		}
	}

	/**
	 * 满件减商品总数次数key
	 * @param siteCode
	 * @param activityId
	 * @param goodSn
	 * @return
	 */
	public static String buildActivityGoodSnCounterKey(String siteCode, String activityId, String goodSn) {
		Object[] keys = new Object[] { PROMOTION_ACTIVITY_GOODSN_CNT, siteCode, activityId, goodSn };
		String activityCounterKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return activityCounterKey;
	}

	/**
	 * 订单支付成功次数
	 * 
	 * @param siteCode
	 * @param pipelineCode
	 * @param conditionId
	 * @param goodSn
	 * @return
	 */
	public static String buildPricePayedCountKey(String siteCode, String pipelineCode, String conditionId,
			String goodSn) {
		Object[] keys = new Object[] { PROMOTION_PAY_PRICE_USER_COUNTER, siteCode, pipelineCode, conditionId, goodSn };
		String payedCountKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return payedCountKey;
	}

	/**
	 * 中奖名单列表 (按奖品类型)
	 * 
	 * @param siteCode
	 * @param activityId
	 * @param type
	 * @return
	 */
	public static String buildRafflePrizeKey(String siteCode, String activityId, Integer type) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_PRIZE, siteCode, activityId, type};
		String prizeKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return prizeKey;
	}

	/**
	 * 中奖名单列表 (按活动ID)
	 *
	 * @param siteCode
	 * @param pipelineCode
	 * @param activityId
	 * @return
	 */
	public static String buildRafflePrizeKey(String siteCode, String pipelineCode, String activityId) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_PRIZE, siteCode, pipelineCode, activityId, "*"};
		String prizeKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return prizeKey;
	}

	/**
	 * 模拟中奖名单列表
	 *
	 * @param siteCode
	 * @param activityId
	 * @param type
	 * @return
	 */
	public static String buildRaffleReceiveLogKey(String siteCode, String activityId, Integer type) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_RECEIVE_LOG, siteCode, activityId, type};
		String prizeKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return prizeKey;
	}

	/**
	 * 用户中奖记录
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @return
	 */
	public static String buildUserRafflePrizeKey(String siteCode, String activityId, Long userId) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_PRIZE_USER, siteCode, activityId, userId};
		String userPrizeKey = StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
		return userPrizeKey;
	}

	/**
	 * 后置礼包
	 * 
	 * @param siteCode
	 * @param pipelineCode
	 * @return
	 */
	public static String buildRafflePostPackageKey(String siteCode, String pipelineCode) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_POST_PACKAGE, siteCode, pipelineCode };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 支付兑换抽奖次数key
	 * 
	 * @param siteCode
	 * @param userId
	 * @param orderSn
	 * @return
	 */
	public static String buildPayedOrderSn(String siteCode, Long userId, String orderSn) {
		Object[] keys = new Object[] { PROMOTION_RAFFLE_POST_PACKAGE, siteCode, userId, orderSn };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	public static String buildPartsKey(String siteCode, String priceId) {
		Object[] keys = new Object[] { Constant.PROMOTION_PARTS, siteCode, priceId };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	public static String buildPayDiscountsKey(String siteCode) {
		Object[] keys = new Object[] { Constant.PAY_DISCOUNTS, siteCode };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	public static String buildPricePriorityKey(String siteCode) {
		Object[] keys = new Object[] { Constant.PROMOTION_PRICE_PRIORITY, siteCode };
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 积分规则key
	 * @param siteCode
	 * @return
	 */
	public static String buildIntegralRuleKey(String siteCode) {
		Object[] keys = new Object[] {PROMOTION_INTEGRAL_RULE, siteCode};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 获取裂变红包key
	 * @param siteCode
	 * @param activityId
	 * @return
	 */
	public static String buildRedPacketKey(String siteCode, String activityId) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY, siteCode, activityId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 获取裂变红包用户已发起的总次数
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @return
	 */
	public static String buildRedPacketUsedCountKey(String siteCode, String activityId, Long userId) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_USRR_COUNT, siteCode, activityId, userId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 获取裂变红包用户已助力的总次数
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @return
	 */
	public static String buildRedPacketAssitUsedCountKey(String siteCode, String activityId, Long userId) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_ASSIT_COUNT, siteCode, activityId, userId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 获取IMEI助力总次数
	 * @param siteCode
	 * @param activityId
	 * @param imei
	 * @return
	 */
	public static String buildRedPacketImeiCountKeyByOpen(String siteCode, String activityId, String imei) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_IMEI_COUNT, siteCode, activityId, imei};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

    /**
     * 获取IMEI发起总次数
     * @param siteCode
     * @param activityId
     * @param imei
     * @return
     */
    public static String buildRedPacketImeiCountKeyByCreate(String siteCode, String activityId, String imei) {
        Object[] keys = new Object[] {RED_PACKET_ACTIVITY_IMEI_CREATE_COUNT, siteCode, activityId, imei};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

    /**
     * 获取裂变红包用户已提现次数key
     * @param siteCode
     * @param activityId
     * @param userId
     * @return
     */
    public static String buildRedPacketWithdrawUserCountKey(String siteCode, String activityId, Long userId) {
        Object[] keys = new Object[] {RED_PACKET_ACTIVITY_WITHDRAW_COUNT, siteCode, activityId, userId};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

    /**
     * 获取裂变红包IMEI已提现次数key
     * @param siteCode
     * @param activityId
     * @param imei
     * @return
     */
    public static String buildRedPacketWithdrawImeiCountKey(String siteCode, String activityId, String imei) {
        Object[] keys = new Object[] {RED_PACKET_ACTIVITY_IMEI_WITHDRAW_COUNT, siteCode, activityId, imei};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

	/**
	 * 当前用户的助力名单列表
	 * @param siteCode
	 * @param activityRecord
	 * @return
	 */
    public static String buildAssistRedPacketUsersKey(String siteCode, String activityRecord) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_ASSIST_USRRS, siteCode, activityRecord};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

	/**
	 * 当前IMEI的助力名单列表
	 * @param siteCode
	 * @param activityId
	 * @param imei
	 * @return
	 */
	public static String buildAssistRedPacketImeisKey(String siteCode, String activityId, String imei) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_ASSIST_IMEIS, siteCode, activityId, imei};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 用户拆红包信息
	 * @param siteCode
	 * @param activityRecord
	 * @param userId
	 * @return
	 */
    public static String buildCurrentUserDismantledAmountKey(String siteCode, String activityRecord, Long userId) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_USRR, siteCode, activityRecord, userId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

	/**
	 * 当前用户发起的正在生效的activityRecordId
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @return
	 */
    public static String buildActivityRecordKey(String siteCode, String activityId, Long userId) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_USRR_RECORD, siteCode, activityId, userId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

	/**
	 * 当前用户发起的正在生效的红包
	 * @param siteCode
	 * @param activityRecordId(具有唯一性)
	 * @return
	 */
	public static String buildRedPacketUserRecordKey(String siteCode, String activityRecordId) {
		Object[] keys = new Object[] {RED_PACKET_ACTIVITY_USRR_RECORD, siteCode, activityRecordId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 红包锁key
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @param type
	 * @return
	 */
	public static String buildRedPacketLockKey(String siteCode, String activityId, Long userId, Integer type) {
		Object[] keys = new Object[] {RED_PACKET_LOCK, siteCode, activityId, userId, type};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 红包锁key
	 * @param siteCode
	 * @param activityId
	 * @param userId
	 * @param type
	 * @return
	 */
	public static String buildRedPacketLockKey(String siteCode, String activityId, Long userId, Long helpUserId, Integer type) {
		Object[] keys = new Object[] {RED_PACKET_LOCK, siteCode, activityId, userId, helpUserId, type};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 获取模板发放coupon总次数Key(老版本coupon领取总数和单用户领取总数是同一个前缀)
	 */
	public static String getTemplateCouponTotalCountKey(String siteCode, String code) {
		String key = Constant.COUPON_TEMPLATE_COUNT_INFO + SEPAREATOR_CHARACTER
				+ siteCode + SEPAREATOR_CHARACTER + code;
		return key;
	}
	/**
	 * 获取模板发放coupon总次数Key(多段领取需求后总领取次数使用新的前缀)
	 * @param sequence  多时段领取时，每个段的序号
	 */
	public static String getTemplateCouponTotalCountKey(String siteCode, String code,Integer sequence) {
		String key = Constant.COUPON_TEMPLATE_TOTAL_COUNT_INFO + SEPAREATOR_CHARACTER
				+ siteCode + SEPAREATOR_CHARACTER + code + SEPAREATOR_CHARACTER+sequence;
		return key;
	}

	/**
	 * 获取模板发放coupon 用户 次数Key
	 */
	public static String buildTemplateCouponUserCountKey(String siteCode, String code, Long userId) {
		String key = Constant.COUPON_TEMPLATE_COUNT_INFO + SEPAREATOR_CHARACTER
				+ siteCode + SEPAREATOR_CHARACTER + code
				+ SEPAREATOR_CHARACTER + userId;
		return key;
	}

	/**
	 * 获取红包助力活动规则key
	 * */
	public static String getActivityRecordRuleKey(String siteCode,String activityId){
		return Constant.RED_PACKET_ACTIVITY + SEPAREATOR_CHARACTER
				+siteCode + SEPAREATOR_CHARACTER + activityId;
	}

	/**
	 * 获取用户发起的助力红包缓存key
	 * */
	public static String getActivityRecordKey(String siteCode, String activityId,Long userId){
		return Constant.RED_PACKET_ACTIVITY_USRR_RECORD + SEPAREATOR_CHARACTER
				+siteCode + SEPAREATOR_CHARACTER + activityId + SEPAREATOR_CHARACTER + userId;
	}

	/**
	 * 获取助力活动已提现的记录key
	 * */
	public static String getPutForwardListKey(String siteCode, String activityId){
		return Constant.RED_PACKET_ACTIVITY_WITHDRAW_RECODE + SEPAREATOR_CHARACTER
				+siteCode + SEPAREATOR_CHARACTER + activityId;
	}

    /**
     * 获取提现轮播列表接口(总金额)Key
     */
	public static String getForwardListByAmountKey(String siteCode, String activityId){
        Object[] keys = new Object[] {RED_PACKET_ACTIVITY_WITHDRAW_AMOUNT_RECODE, siteCode, activityId};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 获取助力名单列表key
	 * */
	public static String getAssistRedPacketUsersKey(String siteCode, String activityRecordId){
		return Constant.RED_PACKET_ACTIVITY_ASSIST_USRRS + SEPAREATOR_CHARACTER
				+siteCode + SEPAREATOR_CHARACTER + activityRecordId;
	}

    /**
     * 获取裂变红包首拆次数
     * @param siteCode
     * @param activityRecordId
     * @return
     */
    public static String buildRedPacketFirstDismantledCountKey(String siteCode, String activityRecordId) {
        Object[] keys = new Object[] {RED_PACKET_ACTIVITY_ASSIST_TOP_ONE_COUNT, siteCode, activityRecordId};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

    /**
     * 获取裂变红包首拆锁
     * @param siteCode
     * @param activityRecordId
     * @return
     */
    public static String buildFirstDismantledRedisLockKey(String siteCode, String activityRecordId) {
        Object[] keys = new Object[] {RED_PACKET_ACTIVITY_ASSIST_TOP_ONE_LOCK, siteCode, activityRecordId};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

    /**
     * 获取裂变红包提现锁Key
     * @param siteCode
     * @param activityRecordId
     * @return
     */
    public static String buildWithdrawRedisLockKey(String siteCode, String activityRecordId) {
        Object[] keys = new Object[] {RED_PACKET_WITHDRAW_LOCK, siteCode, activityRecordId};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }
	/**
	 * 	预生成coupon缓存key
	 * @param siteCode
	 * @param couponCode 系统coupon码
	 * @param sequence  时段
	 * @return
	 */
	public static String getCouponPreBuildKey(String siteCode, String couponCode,int sequence) {
		return Constant.COUPON_PRE_BUILD_KEY + SEPAREATOR_CHARACTER
				+siteCode + SEPAREATOR_CHARACTER + couponCode+ SEPAREATOR_CHARACTER+sequence;
	}
	/**
	 * 	coupon领取防恶意刷缓存key
	 * @param siteCode
	 * @param couponCode 系统coupon码
	 * @param userId  用户id
	 * @return
	 */
	public static String getCouponCountKey(String siteCode, String couponCode,Long userId) {
		return Constant.COUPON_COUNT_KEY + SEPAREATOR_CHARACTER
				+siteCode + SEPAREATOR_CHARACTER + couponCode+ SEPAREATOR_CHARACTER+userId;
	}

	/**
	 * 生成活动不带状态的key
	 *
	 * @param siteCode
	 * @param activityId
	 * @return
	 */
	public static String buildActivityWithoutStatus(String siteCode, String activityId) {
		Object[] keys = new Object[] {PROMOTION_ACTIVITY_WITHOUT_STATUS, siteCode, activityId};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 生成coupon不带状态的key
	 *
	 * @param siteCode
	 * @param couponCode
	 * @return
	 */
	public static String buildCouponWithoutStatus(String siteCode, String couponCode) {
		Object[] keys = new Object[] {PROMOTION_COUPON_WITHOUT_STATUS, siteCode, couponCode};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 生成活动优先排序查询的key
	 *
	 * @param siteCode
	 * @param type
	 * @return
	 */
	public static String buildActivityPriorityKey(String siteCode, Integer type){
		Object []keys=new Object[]{ACTIVITY_TYPE_PRIORITY, siteCode, type};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

	/**
	 * 已经优惠总金额key
	 * @param siteCode
	 * @param promotionId
	 * @param type
	 * @return
	 */
	public static String buildReducedAmountKey(String siteCode, String promotionId, Integer type) {
		Object[] keys = new Object[] {PROMOTION_REDUCE_AMOUNT_KEY, siteCode, promotionId, type};
		return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
	}

    /**
     * 获取领取奖品锁Key
     * @param siteCode
     * @param activityId
     * @param userId
     * @return
     */
    public static String buildGivePrizeRedisLockKey(String siteCode, String activityId, Long userId) {
        Object[] keys = new Object[] {PROMOTION_RAFFLE_GIVE_PRIZE_LOCK, siteCode, activityId, userId};
        return StringUtils.join(Arrays.asList(keys), SEPAREATOR_CHARACTER);
    }

}